package org.wmq.taskschedule.factory;

import org.springframework.beans.BeanUtils;
import org.wmq.taskschedule.algorithm.AdaptiveThresholdExecutor;
import org.wmq.taskschedule.algorithm.AlgorithmExecutor;
import org.wmq.taskschedule.biz.model.DO.Param;

/**
 * 自适应阈值算法执行器工厂类
 * 实现AlgorithmExecutorFactory接口，用于创建AdaptiveThresholdExecutor实例
 */
public class AdaptiveThresholdExecutorFactory implements AlgorithmExecutorFactory {
    private static final AdaptiveThresholdExecutorFactory instance = new AdaptiveThresholdExecutorFactory();

    private AdaptiveThresholdExecutorFactory() {}
    
    /**
     * 获取工厂实例
     * @return AdaptiveThresholdExecutorFactory实例
     */
    public static AdaptiveThresholdExecutorFactory getInstance() {
        return instance;
    }
    
    @Override
    public AlgorithmExecutor getAlgorithmExecutor(Param param) {
        AdaptiveThresholdExecutor adaptiveThresholdExecutor = new AdaptiveThresholdExecutor();
        BeanUtils.copyProperties(param, adaptiveThresholdExecutor);
        return adaptiveThresholdExecutor;
    }
}